package cn.seocoo.platform.api.controller.car;

import cn.seocoo.platform.api.util.JSONResult;
import cn.seocoo.platform.base.domain.BaseCategory;
import cn.seocoo.platform.base.domain.BaseDrivingType;
import cn.seocoo.platform.base.domain.BaseEngine;
import cn.seocoo.platform.base.dto.*;
import cn.seocoo.platform.base.service.*;
import cn.seocoo.platform.plate.service.IPlateHomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName: ApiBaseCarController
 * @description: 发布车辆的基础参数获取
 * @author: wujian
 * @Date: 2019-12-24 16:38
 **/
@RestController
@RequestMapping("/api/base")
public class ApiBaseCarController {
    @Autowired
    private IPlateHomeService iPlateHomeService;
    @Autowired
    private IBaseVehicleTypeService iBaseVehicleTypeService;
    @Autowired
    private IBaseCategoryService iBaseCategoryService;
    @Autowired
    private IBaseDrivingTypeService iBaseDrivingTypeService;
    @Autowired
    private IBaseOperationTypeService iBaseOperationTypeService;

    @Autowired
    private IBaseEngineService iBaseEngineService;

    /**
     * @return cn.seocoo.platform.common.core.domain.JSONResult
     * @Author WuJian
     * @Description //获取车牌归属地
     * @Date 11:47 2019/12/25
     * @Param []
     **/
    @GetMapping("/getPlateHome")
    public JSONResult getPlateHome() {
        List<BaseCommonParentsDto> list = iPlateHomeService.getPlateHomeList();
        return JSONResult.ok(list);
    }


    /**
     * @return cn.seocoo.platform.common.core.domain.JSONResult
     * @Author WuJian
     * @Description //获取车型
     * @Date 11:48 2019/12/25
     * @Param []
     **/
    @GetMapping("/getVehicleType")
    public JSONResult getVehicleType() {
        List<BaseVehicleTypeDto> list = iBaseVehicleTypeService.getVehicleTypeList();
        return JSONResult.ok(list);
    }

    /**
     * @return cn.seocoo.platform.common.core.domain.JSONResult
     * @Author WuJian
     * @Description //根据车型获取类别
     * @Date 11:48 2019/12/25
     * @Param []
     **/
    @GetMapping("/getCategory")
    public JSONResult getCategory(Integer baseVehicleId) {
        List<BaseCategoryDto> list = iBaseCategoryService.getCategoryByBaseVehicleId(baseVehicleId);
        return JSONResult.ok(list);
    }

    /**
     * @return cn.seocoo.platform.common.core.domain.JSONResult
     * @Author WuJian
     * @Description //根据车型获取驱动形式
     * @Date 11:48 2019/12/25
     * @Param []
     **/
    @GetMapping("/getDrivingType")
    public JSONResult getDrivingType(Integer baseVehicleId) {
        List<BaseDrivingTypeDto> list = iBaseDrivingTypeService.getDrivingTypeByBaseVehicleId(baseVehicleId);
        return JSONResult.ok(list);
    }

    /**
     * @return cn.seocoo.platform.common.core.domain.JSONResult
     * @Author WuJian
     * @Description //根据类别获取营运方式
     * @Date 11:48 2019/12/25
     * @Param []
     **/
    @GetMapping("/getOperationType")
    public JSONResult getOperationType(Integer baseCategoryId) {
        BaseCategory baseCategory = iBaseCategoryService.selectBaseCategoryById(baseCategoryId);
        List<BaseCommonDto> list = iBaseOperationTypeService.selectOperationType(baseCategory.getCategoryName());
        return JSONResult.ok(list);
    }


    /**
     * @return cn.seocoo.platform.common.core.domain.JSONResult
     * @Author WuJian
     * @Description //根据类别获取营运方式
     * @Date 11:48 2019/12/25
     * @Param []
     **/
    @GetMapping("/getEngine")
    public JSONResult getEngine() {

        List<BaseCommonDto> list = iBaseEngineService.getEngineList();
        return JSONResult.ok(list);
    }











}
